package org.jeecg.modules.inspection.mapper;


import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.jeecg.modules.inspection.entity.Accept;
import org.jeecg.modules.inspection.entity.PinspectionException;
import org.jeecg.modules.inspection.entity.PinspectionItem;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Description: 巡检运行检查项目
 * @Author: jeecg-boot
 * @Date:   2019-09-26
 * @Version: V1.0
 */
@Repository
public interface PinspectionItemMapper extends BaseMapper<PinspectionItem> {
   @SqlParser(filter = true)
   Integer updateBatch(@Param("items")List<PinspectionItem> items);
   @SqlParser(filter = true)
   void insertBatch(@Param("infos") List<PinspectionItem> items);
   @Select("select id,process_id,is_check from process_inspection_item where process_id = #{processId} and del_flag='0'")
   List<PinspectionItem> selectByProcessId(@Param("processId")String processId);
   @SqlParser(filter = true)
   List<Accept> selectExceptionItemByProjectId();
   @Select("select name from base_project where id =#{projectId} AND del_flag = '0'")
   String selectProjectName(@Param("projectId")String projectId);

   @Update("update process_inspection_item set is_check_res ='1',is_check ='1' where id =#{processItemId} and del_flag='0' ")
    Integer updateStatus(@Param("processItemId") String processItemId);

    List<PinspectionException> queryExistExpection(@Param("processItemId") String processItemId);
   @Update("update process_inspection_item set exec_comfirm_status='0' where id =#{processItemId} and del_flag = '0'")
   void  updateNormal(@Param("processItemId") String processItemId);
}
